package com.sxt.sys.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sxt.sys.domain.Room;
import com.sxt.sys.mapper.RoomMapper;
import com.sxt.sys.service.RoomService;
import com.sxt.sys.utils.DataGridView;
import com.sxt.sys.vo.RoomVo;
@Service
public class RoomServiceImpl implements RoomService {
    @Autowired
	private RoomMapper roomMapper;
 
    
    @Override
	public List<Room> queryAllRoomForList(RoomVo roomVo) {
		// TODO Auto-generated method stub
		return roomMapper.queryAllRoom(roomVo);
	}

	@Override
	public DataGridView queryAllRoom(RoomVo roomVo) {
		Page<Object> page = PageHelper.startPage(roomVo.getPage(),roomVo.getLimit());
		List<Room> data=roomMapper.queryAllRoom(roomVo);
		return new DataGridView(page.getTotal(),data);
	}

	
 //添加
	@Override
	public void addNewRoom(RoomVo roomVo) {
		// TODO Auto-generated method stub
		this.roomMapper.insertSelective(roomVo);
	}


	@Override
	public void deleteRoom(Integer id) {
		// TODO Auto-generated method stub
		 this.roomMapper.deleteByPrimaryKey(id);
	}

}
